/*
 * @Author: mengqingchen mengqingchen@huaru.cc
 * @Date: 2022-08-08 14:57:11
 * @LastEditors: mengqingchen mengqingchen@huaru.cc
 * @LastEditTime: 2022-11-09 13:42:11
 * @FilePath: \sousou_suini_vue\src\utils\resetMessage.js
 * @Description:
 */
let messageInstance = null
const resetMessage = options => {
  if (messageInstance) {
    messageInstance.close()
  }
  messageInstance = ElMessage(options)
}
;['error', 'success', 'info', 'warning'].forEach(type => {
  resetMessage[type] = options => {
    if (typeof options === 'string') {
      options = {
        message: options
      }
    }
    options.type = type
    return resetMessage(options)
  }
})
export const MessageReset = resetMessage
